﻿<!DOCTYPE>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <title>订单计划分解</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
    <style>
        .easyui-linkbutton{margin-left:20px;}
        table tr td{padding:0px 5px}
        .datagrid-row-editing .validatebox-text{text-align:center;}
                    
    </style>
</head>
<body>
    <div class="panelSection">    
        <div class="easyui-panel " title="查询区域" style="padding:3px;width:100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
           <form id="searchForm" method="post">
	    	<table>
	    		<tr  class="divLabel">
	    			<td>施工单号:</td>
                    <td>发动机号:</td>
                    <td>订单号（起）:</td>
                    <td>订单号（止）:</td>
                    <td>订单类型:</td>
                    <td>状态:</td>
	    		</tr>
	    		<tr >
	    			<td><input class="easyui-textbox" type="text" name="txtSGD" style="width: 120px; height: 22px"/></td>
	    			<td><input class="easyui-textbox" type="text" name="txtMachine" style="width: 120px; height: 22px"/></td>
                    <td><input class="easyui-textbox" type="text" name="ScanmfgOrderName" style="width: 120px; height: 22px"/></td>
	    			<td><input class="easyui-textbox" type="text" name="ScanmfgOrderNameLast" style="width: 120px; height: 22px"/></td>
                    <td><input id="ddlTaskType" name="ddlTaskType" style="width: 120px; height: 22px"/></td>
                    <td><input id="ddlOrderStatus" name="ddlOrderStatus" style="width: 120px; height: 22px"/></td>
                    <td><a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.searchData()">查询</a></td>
	    			<td><a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.searchReset()">重置</a></td>
	    		</tr>
	    	</table>
	    </form>
        </div> 
    </div>
   <!-- ------------内容显示区域------------------>
    <div class="panelSection">    
        <div class="easyui-panel " title="订单列表" style="padding:3px;width:100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
        <table id="gdContainerInfo" style="width: 100%; height: 580px" data-options="rownumbers:true,pagination:false,striped:true,checkOnSelect:true,selectOnCheck:true,singleSelect:false,pageNumber:1,pageSize:5,pageList:[5,10,20]"></table>
        <div id="pp" style="float: right" class="easyui-pagination" data-options="   
                 layout:['first','prev','next','last','manual','info'],              
                    total: 0,
                    showPageList: false,
                    showPageInfo: false,
                    showRefresh: false,
                    afterPageText:'共&nbsp{pages}&nbsp页',
                    buttons:[{
                            iconCls:'',
                            text:'Go',
                            id:'pageGo'
                    }]  
                ">
          </div>
        </div>
      </div>

    <div class="panelSection">    
        <div class="easyui-panel " title="分厂订单计划维护" style="padding:3px;width:100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
            <form id="orderForm" method="post">
	    	    <table>
	    		    <tr  class="divLabel">
	    			    <td>计划年份:</td>
                        <td>计划月份:</td>
                        <td>分厂计划开始日期:</td>
                        <td>连台时间间隔（天）:</td>
                        <td>订单类别:</td>
	    		    </tr>
	    		    <tr >
	    			    <td><input class="easyui-combobox" type="text" name="ddlYears" style="width: 120px; height: 22px" id="ddlYears"/></td>
	    			    <td><input class="easyui-combobox" type="text" name="ddlMonth" style="width: 120px; height: 22px" id="ddlMonth"/></td>
                        <td><input class="easyui-datebox" type="text" name="txtplanStartDate" style="width: 120px; height: 22px" id="txtplanStartDate"/></td>
	    			    <td><input class="easyui-numberbox" type="text" name="txtSpan" style="width: 120px; height: 22px"/></td>
                        <td><input class="easyui-combobox" type="text" name="ddlType" style="width: 120px; height: 22px" id="ddlType"/></td>
                        <td><a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.btnSaveOrder()">保存计划</a></td>
	    		    </tr>
                    <tr><td>备注:</td></tr>
                    <tr><td colspan="6"><input class="easyui-textbox" type="text" name="txtNote" style="width: 700px; height: 52px" data-options="multiline:true" id="txtNote"/></td></tr>
	    	    </table>
	         </form>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.MfgOrderSplitPopupForm()" style="margin: 10px 0 10px 20px;">订单分解</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.pupBtnTempSplit()" style="margin: 10px 0 10px 20px;">施工单分解</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.pupTechnicalNoticeSplit()" style="margin: 10px 0 10px 20px;">技通单分解</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.splitNoMergeOrder()" style="margin: 10px 0 10px 20px;" id="splitNoMergeOrder">无阶段订单分解</a>
        </div>
      </div>
     <!--信息提示区域-->
    <div id="statusMessage" style="font-size: 14px; height: 40px"></div>

     <!--订单分解区域-->
    <div id="orderSplitdialog" style="display:none">
            <table>
	    		<tr  class="divLabel">
	    			<td>订单号:</td>
                    <td>发动机号:</td>
                    <td>周期模板:</td>
                    <td>模板名称:</td>
                </tr>
                <tr>
                    <td><input class="easyui-combobox" type="text" name="wbcMfgorder" style="width: 120px; height: 22px" id="wbcMfgorder"/></td>
	    			<td><input class="easyui-textbox" type="text" name="txtEngineNo" style="width: 120px; height: 22px" id="txtEngineNo"readonly/></td>
                    <td><input class="easyui-combobox" type="text" name="ddlTemplet" style="width: 120px; height: 22px" id="ddlTemplet"/></td>
	    			<td><input class="easyui-textbox" type="text" name="txtTempletName" style="width: 120px; height: 22px" id="txtTempletName"/></td>
                    <td><a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.btnSaveTemplet()">保存模板</a></td>
	    			<td><a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.btnClearTemplet()">清除模板</a></td>
                </tr>
            </table>
            <div id="cc" class="easyui-layout" style="width:1035px;height:610px;">
                <div data-options="region:'west',title:''" style="width:550px;">
                    <table id="wgContainerStep" style="width: 100%; height: 602px" data-options="rownumbers:true,pagination:false,striped:true"></table>
                </div>
                <div data-options="region:'center',title:''" style="">
                    <table id="wgResult" style="width: 100%; height: 220px" data-options="rownumbers:true,pagination:false,striped:true"></table>
                    <table>
	    		        <tr  class="divLabel">
	    			        <td>工艺路线:</td>
                            <td>周期:</td>
                            <td>分厂计划开始日期:</td>
                        </tr>
                        <tr>
                            <td><input class="easyui-combobox" type="text" name="ddlWorkFlow" style="width: 130px; height: 22px" id="ddlWorkFlow"/></td>
	    			        <td><input class="easyui-numberbox" type="text" name="txtCycle" style="width: 50px; height: 22px" id="txtCycle" /></td>
                            <td><input class="easyui-datebox" type="text" name="txtfplanStartDate" style="width: 100px; height: 22px" id="txtfplanStartDate"/></td>
                            <td><a href="javascript:void(0)" class="easyui-linkbutton" style="width:68px;margin-left: 0px;" onclick="page.btnSavePlan()">制定计划</a></td>
	    			        <td><a href="javascript:void(0)" class="easyui-linkbutton" style="width:68px;margin-left: 0px;" onclick="page.btnSaveFlow()">调整工艺</a></td>
                        </tr>
                    </table>
                    <table id="wgBom" style="width: 100%; height: 340px" data-options="rownumbers:true,pagination:false,striped:true"></table>
                </div>
            </div>
            <div style="padding-top:20px">
                <a href="javascript:void(0)" class="easyui-linkbutton"  onclick="page.btnCalcPlan()">计划时间计算</a>
                <a href="javascript:void(0)" class="easyui-linkbutton"  onclick="page.btnSubmit()">当前订单应用</a>
                <a href="javascript:void(0)" class="easyui-linkbutton"  onclick="page.btnSubmitAll()">全部订单应用</a>
                <a href="javascript:void(0)" class="easyui-linkbutton"  onclick="$('#orderSplitdialog').dialog('close')">关闭</a>
            </div>
     </div>
     <!--施工单分解区域-->
    <div id="sgddialog" style="display:none;">
       <!-- <div class="panelSection">    
            <div class="easyui-panel " title="施工单工艺查询" style="padding:3px;" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> -->
               <form id="SGDForm" method="post">
	    	    <table>
	    		    <tr  class="divLabel">
	    			    <td>施工单号:</td>
                        <td>发动机号:</td>
                        <td>分解状态:</td>
	    		    </tr>
	    		    <tr >
	    			    <td><input class="easyui-textbox" type="text" name="txtWorkflowName" style="width: 120px; height: 22px"/></td>
	    			    <td><input class="easyui-textbox" type="text" name="txtEngineNO" style="width: 120px; height: 22px" id="txtEngineNO" data-options="readonly:true"/></td>
                        <td><input id="ddlStatus" name="ddlStatus" style="width: 120px; height: 22px"/></td>
                        <td><a href="javascript:void(0)" class="easyui-linkbutton" onclick="sgd.searchData()">查询</a></td>
	    			    <td><a href="javascript:void(0)" class="easyui-linkbutton" onclick="sgd.searchReset()">重置</a></td>
	    		    </tr>
	    	    </table>
	        </form>
         <!--   </div> 
        </div>-->
        <div class="panelSection">    
                <table id="sgdResult" style="width: 100%; height: 230px" data-options="rownumbers:true,pagination:false,striped:true,title:'施工单工艺信息'"></table>
                <div id="ppp" style="float: right" class="easyui-pagination" data-options="   
                 layout:['first','prev','next','last','manual','info'],              
                    total: 0,
                    showPageList: false,
                    showPageInfo: false,
                    showRefresh: false,
                    afterPageText:'共&nbsp{pages}&nbsp页',
                    buttons:[{
                            iconCls:'',
                            text:'Go',
                            id:'SGDpageGo'
                    }]  
                ">
            </div>
            <div style="padding-top:5px;">计划完成时间:<input class="easyui-datebox" type="text" name="wcPlanCompeleteDate" style="width: 120px; height: 22px" id="wcPlanCompeleteDate"/></div>
        </div>
         <div class="panelSection">
                <div class="easyui-panel " title="按钮区域" style="width: 100%;height:100px;padding-top:20px">
                    <a href="javascript:void(0)" class="easyui-linkbutton"  onclick="sgd.btnSGDSubmit()">确定</a>
                    <a href="javascript:void(0)" class="easyui-linkbutton"  onclick="$('#sgddialog').dialog('close')">关闭</a>
                </div>
         </div>
    </div>
    <!--技通单分解区域-->
    <div id="jtddialog" style="display:none;">
               <form id="JTDForm" method="post">
	    	    <table>
	    		    <tr  class="divLabel">
	    			    <td>技通单号:</td>
                        <td>发动机号:</td>
	    		    </tr>
	    		    <tr >
	    			    <td><input class="easyui-textbox" type="text" name="txtWorkflowName" style="width: 120px; height: 22px"/><input name="MfgOrderID" type="hidden" id="wgMFGORDERID"/></td>
	    			    <td><input class="easyui-textbox" type="text" name="txtEngineNO" style="width: 120px; height: 22px" id="jtTxtEngineNO" data-options="readonly:true"/></td>
                        <td><a href="javascript:void(0)" class="easyui-linkbutton" onclick="jtd.searchData()">查询</a></td>
	    			    <td><a href="javascript:void(0)" class="easyui-linkbutton" onclick="jtd.searchReset()">重置</a></td>
	    		    </tr>
	    	    </table>
	        </form>
        <div class="panelSection">    
                <table id="jtdResult" style="width: 100%; height: 230px" data-options="rownumbers:true,pagination:false,striped:true,title:'技通单工艺信息'"></table>
                <div id="pppp" style="float: right" class="easyui-pagination" data-options="   
                 layout:['first','prev','next','last','manual','info'],              
                    total: 0,
                    showPageList: false,
                    showPageInfo: false,
                    showRefresh: false,
                    afterPageText:'共&nbsp{pages}&nbsp页',
                    buttons:[{
                            iconCls:'',
                            text:'Go',
                            id:'JTDpageGo'
                    }]  
                ">
            </div>
            <div style="padding-top:5px;">计划完成时间:<input class="easyui-datebox" type="text" name="jtdPlanCompeleteDate" style="width: 120px; height: 22px" id="jtdPlanCompeleteDate"/></div>
        </div>
         <div class="panelSection">
                <div class="easyui-panel " title="按钮区域" style="width: 100%;height:100px;padding-top:20px">
                    <a href="javascript:void(0)" class="easyui-linkbutton"  onclick="jtd.btnJTDSubmit()">确定</a>
                    <a href="javascript:void(0)" class="easyui-linkbutton"  onclick="$('#jtddialog').dialog('close')">关闭</a>
                </div>
         </div>
    </div>
    
<script src="/InSiteWebApplication/Scripts/CustomPageJs/ReferenceJsLib.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/dayjs.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
 
</body>
</html>



<script  type="text/javascript">
/*
创建人：longb
日期：2022-06-01
描述：订单分解js
*/
var page = {
        pagetotal: 0,
        pageSize: 20,
        pageNumber: 1,
        dtMerge:null,//部件列表信息
        isLoaded:false,
        rootPath: getRootPath(), //网站根路径
        ajaxUrl: getRootPath() + "/Ashx/ZsHandler/ZSMfgOrderMaintainHandler.ashx",
        //初始化页面
        init: function () {
            page.bind();
            page.initCombox();
            customizedEasyuiPagination('pp'); //定制化分页
            page.addEditCell();
            page.GetMfgOrderData();
        },
        //页面事件绑定
        initCombox: function () {
            $('#ddlTaskType').combobox({
                data: [{ id: '常规生产订单', text: '常规生产订单' }, { id: '无物料号订单', text: '无物料号订单'}],
                valueField: 'id',
                textField: 'text',
                panelHeight: 'auto',
                value: '常规生产订单'
            });
            $('#ddlOrderStatus').combobox({
                data: [{ id: '2', text: '已分解' }, { id: '1', text: '未分解'}],
                valueField: 'id',
                textField: 'text',
                panelHeight: 'auto',
                value: '1',
                onSelect:function(record){
                    if(record.id=="1"){
                        $('#splitNoMergeOrder').css('display','')
                    }else{
                         $('#splitNoMergeOrder').css('display','none')
                    }
                }
            });

            var currYear = Number(dayjs(new Date()).format('YYYY'));
            $('#ddlYears').combobox({
                data: [{ id: currYear - 1, text: currYear - 1 }, { id: currYear, text: currYear }, { id: currYear + 1, text: currYear + 1}],
                valueField: 'id',
                textField: 'text',
                panelHeight: 'auto',
                value: currYear
            });
            var months = [];
            for (var i = 1; i <= 12; i++) {
                var m = i < 10 ? '0' + i : i;
                months.push({ id: m, text: m });
            }
            $('#ddlMonth').combobox({
                data: months,
                valueField: 'id',
                textField: 'text',
                panelHeight: 'auto',
                value: dayjs(new Date()).format('MM')
            });
            $('#ddlType').combobox({
                data:[],
                valueField: 'id',
                textField: 'text',
                panelHeight: 'auto',
            });

        },
        bind: function () {
            //任务单信息
            $("#gdContainerInfo").datagrid({
                checkOnSelect: false,
                selectOnCheck: false,
                singleSelect: true,
                onLoadSuccess: function (data) {
                    $('#pp').pagination('refresh', {	// 改变选项，并刷新分页栏信息
                        total: page.pagetotal,
                        pageSize: page.pageSize,
                        pageNumber: page.pageNumber
                    });
                    customizedEasyuiPagination('pp'); //定制化分页
                },
                onSelect: function (index, row) {
                    $("#gdContainerInfo").datagrid("uncheckAll").datagrid("checkRow", index); //单选行，去掉同时勾选
                    var type = [];
                    if(row.NOTES!=null){
                        $.each(row.NOTES.split(';'), function (index, item) {
                            type.push({id:item,text:item});
                        });
                    }
                    type.push({id:'',text:'\u3000'});
                    $('#ddlType').combobox({
                        data: type,
                        valueField: 'id',
                        textField: 'text',
                        panelHeight: 'auto',
                        value:row.MFGTYPE
                    });
                    $('#txtplanStartDate').datebox('setValue',row.FACTORYSTARDATE);
                    $('#txtNote').textbox('setValue',row.MNOTES);
                },
                onCheck: function (index, rowData) { },
                onUncheck: function (index, rowData) { $("#gdContainerInfo").datagrid("unselectAll"); },
                onCheckAll: function (index, rowData) {$("#gdContainerInfo").datagrid("unselectAll"); },
                //onUncheckAll: function (index, rowData) {$("#gdContainerInfo").datagrid("unselectAll"); },
                columns: [[
                 { field: 'ck', title: '选择', checkbox: true },
                 { field: 'MFGORDERNAME', title: '生产订单号', width: 120 },
                 { field: 'ORDERTYPENAME', title: '订单类型', width: 100 },
		         { field: 'MFGTYPE', title: '订单类别', width: 100 },
		         { field: 'QTY', title: '订单数', width: 60, align: 'center' }, //--
                 { field: 'ENGINENO', title: '发动机号', width: 100 },
                 { field: 'PRODUCTNAME', title: '物料号', width: 90 },
                 { field: 'PRODUCTDESCRIPTION', title: '物料描述', width: 150 },
                 { field: 'PRODUCTFAMILYNAME', title: '机型', width: 130 },
                 { field: 'PLANNEDSTARTDATE', title: '计划开始日期', width: 130, formatter: function (value, row, index) { if(value!=null){return dayjs(value).format("YYYY-MM-DD"); }} },
                 { field: 'PLANNEDCOMPLETIONDATE', title: '计划完成日期', width: 130, formatter: function (value, row, index) {if(value!=null){ return dayjs(value).format("YYYY-MM-DD");} } },
                 { field: 'FACTORYMONTH', title: '分厂计划月份', width: 100 },
                 { field: 'FACTORYSTARDATE', title: '分厂计划开始日期', width: 130, formatter: function (value, row, index) { if(value!=null){return dayjs(value).format("YYYY-MM-DD"); }} },
                 { field: 'FACTORYCOMPLETIONDATE', title: '分厂计划完成日期', width: 130, formatter: function (value, row, index) { if(value!=null){return dayjs(value).format("YYYY-MM-DD"); }} },
	           ]]
            });
            //分页事件
            $('#pp').pagination({
                onSelectPage: function (pageNumber, pageSize) {
                    customizedEasyuiPagination('pp'); //定制化分页
                    page.pageSize = pageSize; page.pageNumber = pageNumber;
                    page.GetMfgOrderData();
                }
            });
            //绑定分页go按钮
            $('#pageGo').on("click", function () {
                var pageNumber = $(this).parents('tr').find('.pagination-num').val();
                page.pageNumber = pageNumber;
                page.GetMfgOrderData();
            });
            //清除按钮
            $('#btnReset').on("click", function () {
                page.reset(true, true);
                page.pageNumber = 1; page.pagetotal = 0
                $('#pp').pagination('refresh', {
                    total: page.pagetotal,
                    pageSize: page.pageSize,
                    pageNumber: page.pageNumber
                });
            });
            //大阶段数据表
            $('#wgContainerStep').datagrid({
                singleSelect: true,
                 columns: [[
                 { field: 'WORKFLOWSTEPNAME', title: '阶段', width: 120 },
                 { field: 'CYCLETIME', title: '周期', width: 100 ,align:'center',editor: { type: 'textbox',options:{precision:1} }},///cycletime
		         { field: 'PLANNEDSTARTDATE', title: '计划开始日期', width: 130,formatter: function (value, row, index) { if(value!=null){return dayjs(value).format("YYYY-MM-DD HH:mm"); }} },
		         { field: 'PLANNEDFINISHDATE', title: '计划完成日期', width: 130,formatter: function (value, row, index) { if(value!=null){return dayjs(value).format("YYYY-MM-DD HH:mm"); }}}, 
                 ]],
                onLoadSuccess:function(data){
                    $.each(data.rows,function(index,item){
                        $('#wgContainerStep').datagrid('editCell', { index: index, field: 'CYCLETIME' });
                    });
                },
                 onSelect: function (index, row) {
                    page.getwgResult(row);
                 }
            });
            //部件数据表
            $('#wgResult').datagrid({
                 checkOnSelect: false,
                 selectOnCheck: false,
                 singleSelect: true,
                 columns: [[
                 { field: 'ck', title: '选择', checkbox: true },
                 { field: 'PRODUCTNAME', title: '件号', width: 80 },
                 { field: 'PRODUCTREVISION', title: '版本', width: 50,align:'center' },//productrevision
		         { field: 'WORKFLOWNAMEVER', title: '工艺路线及版本', width: 130 },//workflownamever
		         { field: 'WFDESC', title: '名称', width: 120}, 
                 { field: 'CYCLETIME', title: '周期(天)', width: 60,align:'center'}, 
                 { field: 'PLANNEDSTARTDATE', title: '分厂计划开始日期', width: 120,formatter: function (value, row, index) { if(value!=null){return dayjs(value).format("YYYY-MM-DD HH:mm:ss"); }}}, 
                 { field: 'PLANNEDFINISHDATE', title: '分厂计划完成日期', width: 120,formatter: function (value, row, index) { if(value!=null){return dayjs(value).format("YYYY-MM-DD HH:mm:ss"); }}}, 
                 { field: 'CONTAINERNO', title: '批次任务号', width: 120}, 
                 { field: 'XX', title: '', width: 10}, 
                 ]],
                 onSelect:function(index, row){
                    page.getBomListbyWorkflowid(row);
                 },
                 onCheck: function (index, rowData) {if(page.isLoaded){rowData.ckSelect=true; page.wgResultCheckChange(rowData);}},
                 onUncheck: function (index, rowData) {if(page.isLoaded){rowData.ckSelect=false;page.wgResultCheckChange(rowData);} },
                 onLoadSuccess:function(data){
                    $('#orderSplitdialog').find('.datagrid-header-check').html('选择');
                    var n=0;
                    $.each(data.rows,function(index,item){
                        if(item.ckSelect=="True"){
                            $('#wgResult').datagrid('checkRow',index);
                        }
                        n++;
                    });
                    if(data.total>0&&data.total==n){
                        page.isLoaded=true;
                    }
                 }
            });
            //BOM数据表
            $('#wgBom').datagrid({
                 columns: [[
                 { field: 'BOMNAME', title: 'Bom名称', width: 130 },
                 { field: 'CHILDPRODUCTNAME', title: '零件件号', width: 130 },//ChildproductName
		         { field: 'CHILDDESCRIPTION', title: '零件名称', width: 150 }//Childdescription
                 ]]
            });
        },
        //查询
        searchData: function () {
            page.reset(false, true);
            page.pageNumber = 1;
            page.GetMfgOrderData();
        },
        //查询任务单信息
        GetMfgOrderData: function () {
            var frdata = $('#searchForm').serializeArray();
            var data = {};
            $.each(frdata, function () {
                data[this.name] = this.value
            });
            var param = {
                action: "GetMfgOrderData",
                pageSize: page.pageSize,
                pageNumber: page.pageNumber,
                data: JSON.stringify(data)
            };
            page.post(param, function (res) {
                if (res.Result) {
                    page.pagetotal = res.RowCount;
                    $('#gdContainerInfo').datagrid('loadData', res.DBTable)
                }
            });
        },
        btnSaveOrder:function()
        {
            var Rows = $('#gdContainerInfo').datagrid('getChecked');
            if (Rows.length == 0) { displayMessage("请勾选至少一条任务单再进行操作", false); return; }
            var frdata = $('#orderForm').serializeArray();
            var data = {};
            $.each(frdata, function () {
                data[this.name] = this.value
            });
            if(data["txtplanStartDate"]==""){displayMessage("请输入分厂计划开始日期再进行操作", false); return;}
            if(Rows.length>1&&(data["txtSpan"]==""||data["txtSpan"]=="0")){displayMessage("连台时间间隔应大于0 !", false); return;}
            if(data["txtSpan"]==""){data["txtSpan"]="0";}

            var param = {
                action: "SaveMfgOrderData",
                fdata: JSON.stringify(data),
                data:JSON.stringify(Rows)
            };
            page.post(param, function (res) {
                if (res.Result) {
                   page.GetMfgOrderData();
                }
                displayMessage(res.Message, res.Result);
            });
        },
        //订单分解
        MfgOrderSplitPopupForm:function()
        {
            clearMessage();
            $('#wgResult').datagrid('loadData',[]);
            $('#wgBom').datagrid('loadData',[]);
            if($('#ddlTaskType').combobox('getValue')=="无物料号订单"){
                displayMessage("请点击施工单分解！", false); return;
            }
            var Rows = $('#gdContainerInfo').datagrid('getChecked');
            if (Rows.length == 0) { displayMessage("请勾选至少一条任务单再进行操作", false); return; }
            page.post({action:'GetMfgOrderSplitData',fdata:JSON.stringify({ddlOrderStatus:$('#ddlOrderStatus').combobox('getValue')}),data:JSON.stringify(Rows)}, function (res) {
                if (res.Result) {
                   page.dtMerge=null;
                   page.dtMfgStep=null;
                   page.InitComboxMfg();
                    //$('#wgContainerStep').datagrid('loadData', res.DBDataSet.dtMfgStep);
                    //page.dtMerge=res.DBDataSet.dtMerge;
                    page.ShowDialog();
                }else{
                    displayMessage(res.Message, false);
                }
            });

            
        },
        InitComboxMfg:function(){
         //订单下拉选择
         var mfgRows = $('#gdContainerInfo').datagrid('getChecked');
           $('#wbcMfgorder').combobox({ 
               data: mfgRows,
               valueField: 'MFGORDERID',
               textField: 'MFGORDERNAME',
               panelHeight: 'auto',
               value:mfgRows[0].MFGORDERID,
               onSelect:function(record){
                   $('#txtEngineNo').textbox('setValue',record.ENGINENO);
                   $('#wgResult').datagrid('loadData',[]);
                   $('#wgBom').datagrid('loadData',[]);
                   page.post({action:'GetMfgMergeData',data:JSON.stringify([record]),fdata:JSON.stringify({MfgOrderId:$('#wbcMfgorder').combobox('getValue'),TempletName:$('#txtTempletName').textbox('getValue')})}, function (res) {
                        if (res.Result) {
                           //page.InitComboxMfgAndTemplet(mfgRows,res.DBTable);
                           page.InitComboxtemplet(res.DBTable,res.ReturnData);
                            $('#wgContainerStep').datagrid('loadData', res.DBDataSet.dtMfgStep);
                            page.dtMerge=res.DBDataSet.dtMerge;
                            page.ShowDialog();
                        }else{
                            displayMessage(res.Message, false);
                        }
                 });
               }
               });
               
        },
        InitComboxtemplet:function(templet,stemplet){
            if(templet.length>0){templet.splice(0,0,{TEMPLETNAME:'\u3000'})}
            $('#txtTempletName').textbox('setValue','');
               $('#ddlTemplet').combobox({ 
               data: templet,
               valueField: 'TEMPLETNAME',
               textField: 'TEMPLETNAME',
               panelHeight: 'auto',
               value:stemplet.length>0?stemplet[0].TEMPLETNAME:'',
               onSelect:function(record){
                   $('#txtTempletName').textbox('setValue',record.TEMPLETNAME);
               }
               });
        },
        ShowDialog:function(){
            $('#orderSplitdialog').dialog({
                title: '订单计划分解',
                width: 1050,
                height: 780,
                closed: false,
                cache: false,
                modal: true,
                onClose:function(){page.searchData();//关闭弹窗-重新查询
                page.dtMerge=null;
                }
            });
        },
        //保存模板
        btnSaveTemplet:function(){
            if($('#txtTempletName').textbox('getValue')==""){
                displayMessage("请输入或选择模板名称", false); return; 
            }
           page.post({action:'SaveTemplet',data: JSON.stringify({txtTempletName:$('#txtTempletName').textbox('getValue'),ddlTemplet:$('#ddlTemplet').combobox('getValue'),MfgorderId:$('#wbcMfgorder').combobox('getValue')})},function(res){
                displayMessage(res.Message, res.Result);
            });
        },
        //清除模板
        btnClearTemplet:function(){
            if($('#txtTempletName').textbox('getValue')==""){
                displayMessage("没有输入模板", false); return; 
            }
            page.post({action:'ClearTemplet',data: JSON.stringify({txtTempletName:$('#txtTempletName').textbox('getValue')})},function(res){
                displayMessage(res.Message, res.Result);
            });
        },
        //模板选择数据变化事件
        templetDataChanged:function(){},
        //部件信息数据
        getwgResult:function(row){
            page.isLoaded=false;
            var dtMerge=[];
             page.dtMerge.forEach(function (item) {
                    if(item.WORKFLOWSTEPID==row.WORKFLOWSTEPID&&item.WORKFLOWID!=row.WORKFLOWID){
                        dtMerge.push(item);
                    }
             });
              $('#wgResult').datagrid('loadData',dtMerge);
        },
        //部件工艺使用--bom
        getBomListbyWorkflowid:function(row){
            page.post({action:'GetBomListbyWorkflowid',data: JSON.stringify(row)},function(res){
                if(res.Result){
                    $('#wgBom').datagrid('loadData',res.DBTable);
                    var workflow=res.ReturnData;
                    workflow.splice(0,0,{WORKFLOWID:'',WORKFLOWNAMEVER:'\u3000'})
                    $('#ddlWorkFlow').combobox({ 
                       data:workflow,
                       valueField: 'WORKFLOWID',
                       textField: 'WORKFLOWNAMEVER',
                       panelHeight: 'auto',
                       value:'',
                       onSelect:function(record){
                           row.DDWORKFLOWID=record.WORKFLOWID;
                           page.post({action:'WorkFlowDataChange',fdata:JSON.stringify(row)},function(res){
                                $('#txtCycle').numberbox('setValue',res.ReturnData);
                           });
                       }
                    });
                }
                });
        },
        //部件多选框变化
        wgResultCheckChange:function(row){
            var param={
                action:'WgResultCheckChange',
                fdata:JSON.stringify({MfgOrderId:$('#wbcMfgorder').combobox('getValue')}),
                dtMerge:JSON.stringify(page.dtMerge),
                row:JSON.stringify(row)
            };
             page.post(param,function(res){
                    if(res.Result){
                        page.dtMerge=res.ReturnData;
                    }else{
                    displayMessage(res.Message, res.Result);
                    }
                 });
        },
        //制定计划
        btnSavePlan:function(){
            var rows = $('#wgResult').datagrid('getRows');//部件数据表
            var ddlWorkFlow=$('#ddlWorkFlow').combobox('getValue');//工艺
            var txtfplanStartDate=$('#txtfplanStartDate').datebox('getValue');//分厂计划开始时间
            var txtCycle=$('#txtCycle').numberbox('getValue');//周期
            var plannedfinishdate=$('#wgContainerStep').datagrid('getSelected').PLANNEDFINISHDATE;//大阶段要求完成日期
            if(rows.length==0){displayMessage("请先勾选至少一笔记录再进行操作", false); return;}
            if(ddlWorkFlow==""){displayMessage("请选择工艺路线", false); return;}
            if(txtfplanStartDate==""){displayMessage("请输入开始时间", false); return;}
            var param={
                action:'SaveProductPlan',
                fdata:JSON.stringify({ddlWorkFlow:ddlWorkFlow,txtfplanStartDate:txtfplanStartDate,txtCycle:txtCycle==""?"0":txtCycle,plannedfinishdate:plannedfinishdate}),
                dtMerge:JSON.stringify(page.dtMerge),
                dt:JSON.stringify(rows),
            };
            page.post(param,function(res){
                    if(res.Result){
                        page.dtMerge=res.ReturnData;
                        $('#wgResult').datagrid('loadData',res.DBTable);
                    }else{
                        displayMessage(res.Message, res.Result);
                    }
                 });
        },
        //调整工艺
        btnSaveFlow:function(){
            var rows = $('#wgResult').datagrid('getRows');//部件数据表
            var row=$('#wgResult').datagrid('getSelected');//部件选中行
            var WorkFlowID=$('#ddlWorkFlow').combobox('getValue');//工艺ID
            var WorkflowName=$('#ddlWorkFlow').combobox('getText');//工艺名称
            var txtfplanStartDate=$('#txtfplanStartDate').datebox('getValue');//分厂计划开始时间
            var txtCycle=$('#txtCycle').numberbox('getValue');//周期
            var wgRow=$('#wgContainerStep').datagrid('getSelected');//大阶段选中行
            if(row==null){displayMessage("请选中一笔记录再进行操作", false); return;}
            if(WorkFlowID==""){displayMessage("请选择工艺路线", false); return;}
            if(txtCycle==""||Number(txtCycle)==0){displayMessage("请输入周期且大于0", false); return;}
            if(txtfplanStartDate==""){displayMessage("请输入开始时间", false); return;}
            var param={
                action:'UpdateMergeWorkFlow',
                fdata:JSON.stringify({WorkflowId:WorkFlowID,WorkflowName:WorkflowName,txtfplanStartDate:txtfplanStartDate,txtCycle:txtCycle}),
                dtMerge:JSON.stringify(page.dtMerge),
                row:JSON.stringify(row)
            };
            page.post(param,function(res){
                    if(res.Result){
                        page.dtMerge=res.ReturnData;
                        page.getwgResult(wgRow);
                    }else{
                        displayMessage(res.Message, res.Result);
                    }
                 });
        },
        //计划时间计算
        btnCalcPlan:function(){
          $('#wgContainerStep').datagrid('acceptChanges');//暂存列表修改数据
          var rows=$('#wgContainerStep').datagrid('getRows');//修改后的大阶段数据
          var dtMerge=[];//所有的部件信息
          $.each(page.dtMerge,function(index,item){
            item.CYCLETIME=item.CYCLETIME+"";
            dtMerge.push(item);
          });
          page.post({action:'CalcContainerPlan',data: JSON.stringify(rows),dt:JSON.stringify(dtMerge)},function(res){
                if(res.Result){
                     $('#wgContainerStep').datagrid('loadData',res.DBTable)
                     page.dtMerge=res.ReturnData;
                }else{
                    $('#wgContainerStep').datagrid('loadData',rows)
                }
                displayMessage(res.Message, res.Result);
           });
        },
        //当前订单应用
        btnSubmit:function(){
           page.SaveSessionToDB('One');
        },
        //全部订单应用
        btnSubmitAll:function(){
           page.SaveSessionToDB('All');
        },
        SaveSessionToDB:function(flag){
            $('#wgContainerStep').datagrid('acceptChanges');//暂存列表修改数据
            var rows=$('#wgContainerStep').datagrid('getRows');
            var CheckOrderdt = $('#gdContainerInfo').datagrid('getChecked');//勾选的订单
            page.post({action:'CalcContainerPlan',data: JSON.stringify(rows),dt:JSON.stringify(page.dtMerge),wg:JSON.stringify(rows)},function(res){
                if(res.Result){
                 $('#wgContainerStep').datagrid('loadData',res.DBTable)
                page.dtMerge=res.ReturnData;
                var param={
                    action:'SaveSessionToDB',
                    flag:flag,
                    fdata:JSON.stringify({MfgOrderId:$('#wbcMfgorder').combobox('getValue'),TempletName:$('#txtTempletName').textbox('getValue')}),
                    dt:JSON.stringify(CheckOrderdt),
                    wg:JSON.stringify(rows),//大阶段工艺
                    dtMerge:JSON.stringify(page.dtMerge)
                    }
                 page.post(param,function(res){
                    if(res.Result){page.InitComboxMfg();}
                    displayMessage(res.Message, res.Result);
                 });
             }});
        },
        //施工单分解
        pupBtnTempSplit: function () {
            var Rows = $('#gdContainerInfo').datagrid('getChecked');
            if (Rows.length == 0||Rows.length>1) { displayMessage("请选择一条任务单再进行操作", false); return; }
            $('#txtEngineNO').textbox('setValue',Rows[0].ENGINENO);
            $('#sgdResult').datagrid('loadData', []);
            $('#sgddialog').dialog({
                title: '施工单分解',
                width: 850,
                height: 480,
                closed: false,
                cache: false,
                modal: true,
                onClose:function(){page.searchData();//关闭弹窗-重新查询
                }
            });
        },
        //技通单分解
        pupTechnicalNoticeSplit: function () {
            var Rows = $('#gdContainerInfo').datagrid('getChecked');
            if (Rows.length == 0||Rows.length>1) { displayMessage("请选择一条任务单再进行操作", false); return; }
            $('#jtTxtEngineNO').textbox('setValue',Rows[0].ENGINENO);
            $('#wgMFGORDERID').val(Rows[0].MFGORDERID);
            $('#jtdResult').datagrid('loadData', []);
            $('#jtddialog').dialog({
                title: '技通单分解',
                width: 850,
                height: 480,
                closed: false,
                cache: false,
                modal: true,
                onClose:function(){page.searchData();//关闭弹窗-重新查询
                }
            });
        },
        //无大阶段订单分解
        splitNoMergeOrder:function(){
            var Rows = $('#gdContainerInfo').datagrid('getChecked');
            if (Rows.length == 0) { displayMessage("请选择至少一条无大阶段任务单再进行操作", false); return; }
            var param={
                    action:'SplitNoMergeOrder',
                    data:JSON.stringify(Rows)
                    };
            page.post(param,function(res){
                    if(res.Result){page.GetMfgOrderData();}
                    displayMessage(res.Message, res.Result);
                 });
        },
        //查询重置
        searchReset: function () {
            $('#searchForm').form('clear');
            $('#orderForm').form('clear');
            page.initCombox();
        },
        //清除方法，重要！！！
        reset: function (iscondition, isresult) {
            clearMessage();
        },
        //post数据
        post: function (param, callback) {
            $.ajax({
                type: "Post",
                url: page.ajaxUrl,
                data: param,
                cashe: false,
                async: true,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                }
            });
        },
    addEditCell: function () //给easyuigrid新增editcell方法
    {
        $.extend($.fn.datagrid.methods, {
            editCell: function (jq, param) {
                return jq.each(function () {
                    var opts = $(this).datagrid('options');
                    var fields = $(this).datagrid('getColumnFields', true).concat($(this).datagrid('getColumnFields'));
                    for (var i = 0; i < fields.length; i++) {
                        var col = $(this).datagrid('getColumnOption', fields[i]);
                        col.editor1 = col.editor;
                        if (fields[i] != param.field) {
                            col.editor = null;
                        }
                    }
                    $(this).datagrid('beginEdit', param.index);
                    for (var i = 0; i < fields.length; i++) {
                        var col = $(this).datagrid('getColumnOption', fields[i]);
                        col.editor = col.editor1;
                    }
                });
            }
        });
    }
    
    };
var sgd={
    pagetotal: 0,
    pageSize: 15,
    pageNumber: 1,
    init:function(){
        customizedEasyuiPagination('ppp'); //定制化分页
        sgd.initCombox();
        sgd.bind();
    },
    initCombox: function () {
      $('#ddlStatus').combobox({
          data: [{ id: '未使用', text: '未使用' }, { id: '已使用', text: '已使用'}, { id: '未校对', text: '未校对'}],
          valueField: 'id',
          textField: 'text',
          panelHeight: 'auto',
          value: '未使用'
      });
     },
    bind:function(){
        $('#sgdResult').datagrid({
                 checkOnSelect: true,
                 selectOnCheck: true,
                 singleSelect: true,
                 columns: [[
                 { field: 'ck', title: '选择', checkbox: true },
                 { field: 'WORKFLOWNAME', title: '施工单', width: 100 },
                 { field: 'LY2MODLE_NODE', title: '发动机号', width: 80 },
		         { field: 'PRODUCTFAMILYNAME', title: '机型', width: 70 },
		         { field: 'MFGORDERNAME', title: '订单号', width: 80}, 
                 { field: 'CONTAINERNO', title: '任务单号', width: 100,align:'center'}, 
                 { field: 'NOTES', title: '返修原因', width: 120}, 
                 { field: 'DISPATCHDATE', title: '下发时间', width: 100,formatter: function (value, row, index) { if(value!=null){return dayjs(value).format("YYYY-MM-DD HH"); }}}, 
                 { field: 'CHECKFULLNAME', title: '校对人', width: 100}, 
                 ]],
                 onLoadSuccess:function(data){
                    $('#sgddialog').find('.datagrid-header-check').html('选择');
                    $('#ppp').pagination('refresh', {	// 改变选项，并刷新分页栏信息
                        total: sgd.pagetotal,
                        pageSize: sgd.pageSize,
                        pageNumber: sgd.pageNumber
                    });
                    customizedEasyuiPagination('ppp'); //定制化分页
                 }
            });
            //分页事件
            $('#ppp').pagination({
                onSelectPage: function (pageNumber, pageSize) {
                    customizedEasyuiPagination('ppp'); //定制化分页
                    sgd.pageSize = pageSize; sgd.pageNumber = pageNumber;
                    sgd.GetSGDData();
                }
            });
            //绑定分页go按钮
            $('#SGDpageGo').on("click", function () {
                var pageNumber = $(this).parents('tr').find('.pagination-num').val();
                sgd.pageNumber = pageNumber;
                sgd.GetSGDData();
            });
    },
    searchData: function () {
         sgd.pageNumber = 1;
         sgd.GetSGDData();
     },
     //查询重置
    searchReset: function () {
       $('#SGDForm').form('clear');
       $('#txtEngineNO').textbox({'readonly':false});
       sgd.initCombox();
    },
    GetSGDData:function(){
         var frdata = $('#SGDForm').serializeArray();
            var data = {};
            $.each(frdata, function () {
                data[this.name] = this.value
            });
            var param = {
                action: "GetSGDData",
                pageSize: sgd.pageSize,
                pageNumber: sgd.pageNumber,
                data: JSON.stringify(data)
            };
            page.post(param, function (res) {
                if (res.Result) {
                    sgd.pagetotal = res.RowCount;
                    $('#sgdResult').datagrid('loadData', res.DBTable)
                }
            });
    },
    ///施工单确认
    btnSGDSubmit:function(){
        var row= $('#sgdResult').datagrid('getSelected');
        var wcPlanCompeleteDate=$('#wcPlanCompeleteDate').datebox('getValue');
        if(row==null){displayMessage("请选择施工单", false); return;}
        if(row.CHECKFULLNAME==""){displayMessage("施工单未校对!", false); return;}
        if(wcPlanCompeleteDate==""){displayMessage("请先选择计划完成时间", false); return;}
        if(dayjs(wcPlanCompeleteDate)<new Date()){displayMessage("计划完成时间不能小于当前时间", false); return;}
        var wgRow=$('#gdContainerInfo').datagrid('getChecked')[0];
        var rows=$('#gdContainerInfo').datagrid('getRows')
        var param={
            action:'SplitTempOrder',
            fdata:JSON.stringify({PlannedFinishDate:wcPlanCompeleteDate,engineNo:wgRow.ENGINENO,MfgOrderList:wgRow.MFGORDERID+",",WorkFlowName:row.WORKFLOWNAME+","}),
            data:JSON.stringify(rows)
        }
        page.post(param, function (res) {
                $('#sgddialog').dialog('close');
                displayMessage(res.Message,res.Result);
            });
    }

}

var jtd={
    pagetotal: 0,
    pageSize: 15,
    pageNumber: 1,
    init:function(){
        customizedEasyuiPagination('pppp'); //定制化分页
        jtd.bind();
    },
    bind:function(){
        $('#jtdResult').datagrid({
                checkOnSelect: false,
                selectOnCheck: false,
                 columns: [[
                 { field: 'ck', title: '选择', checkbox: true ,width: 100},
                 { field: 'WORKFLOWNAME', title: '技通单', width: 100 },
                 { field: 'ENGINENO', title: '发动机号', width: 80 },
                 { field: 'BEGINDATE', title: '计划开始日期', width: 100,formatter: function (value, row, index) { if(value!=null){return dayjs(value).format("YYYY-MM-DD"); }}}, 
                 { field: 'FINISHDATE', title: '计划结束日期', width: 100,formatter: function (value, row, index) { if(value!=null){return dayjs(value).format("YYYY-MM-DD"); }}}, 
                 { field: 'NOTICEDATE', title: '下发时间', width: 130,formatter: function (value, row, index) { if(value!=null){return dayjs(value).format("YYYY-MM-DD HH"); }}}, 
                 { field: 'NOTES', title: '备注', width: 200}, 
                 ]],
                 onClickRow:function(index,row){$(this).datagrid('unselectRow',index);},
                 onLoadSuccess:function(data){
                    $('#jtddialog').find('.datagrid-header-check').html('选择');
                    $('#pppp').pagination('refresh', {	// 改变选项，并刷新分页栏信息
                        total: jtd.pagetotal,
                        pageSize: jtd.pageSize,
                        pageNumber: jtd.pageNumber
                    });
                    customizedEasyuiPagination('pppp'); //定制化分页
                    $.each(data.rows,function(index,item){
                        if(item.ENGINEPARTPLANNUM==1){$('#jtdResult_datagrid-row-r6-2-'+index).find('input').attr('disabled','disabled');}
                    });
                 }
            });
            //分页事件
            $('#pppp').pagination({
                onSelectPage: function (pageNumber, pageSize) {
                    customizedEasyuiPagination('pppp'); //定制化分页
                    jtd.pageSize = pageSize; jtd.pageNumber = pageNumber;
                    jtd.GetJTDData();
                }
            });
            //绑定分页go按钮
            $('#JTDpageGo').on("click", function () {
                var pageNumber = $(this).parents('tr').find('.pagination-num').val();
                jtd.pageNumber = pageNumber;
                jtd.GetJTDData();
            });
    },
    searchData: function () {
         jtd.pageNumber = 1;
         jtd.GetJTDData();
     },
     //查询重置
    searchReset: function () {
       $('#JTDForm').form('clear');
       $('#jtTxtEngineNO').textbox({'readonly':false});
    },
    GetJTDData:function(){
         var frdata = $('#JTDForm').serializeArray();
            var data = {};
            $.each(frdata, function () {
                data[this.name] = this.value
            });

            var param = {
                action: "GetJTDData",
                pageSize: jtd.pageSize,
                pageNumber: jtd.pageNumber,
                data: JSON.stringify(data)
            };
            page.post(param, function (res) {
                if (res.Result) {
                    jtd.pagetotal = res.RowCount;
                    $('#jtdResult').datagrid('loadData', res.DBTable)
                }
            });
    },
    ///技通单确认
    btnJTDSubmit:function(){
        var rows= $('#jtdResult').datagrid('getChecked');
        var jtdPlanCompeleteDate=$('#jtdPlanCompeleteDate').datebox('getValue');
        if(rows.length==0){displayMessage("请选择技通单", false); return;}
        if(jtdPlanCompeleteDate==""){displayMessage("请先选择计划完成时间", false); return;}
        if(dayjs(jtdPlanCompeleteDate)<new Date()){displayMessage("计划完成时间不能小于当前时间", false); return;}
        var wgRow=$('#gdContainerInfo').datagrid('getChecked');
        var param={
            action:'TechnicalWorkflowForSplit',
            fdata:JSON.stringify({PlannedFinishDate:jtdPlanCompeleteDate}),//计划完成时间
            data:JSON.stringify(rows),//勾选的技通单信息
            row:JSON.stringify(wgRow)//勾选的订单行
        }
        page.post(param, function (res) {
                $('#jtddialog').dialog('close');
                displayMessage(res.Message,res.Result);
            });
    }

}

$(function () {
    page.init();
    sgd.init();
    jtd.init();
});
</script>
